import {submitApi,shop} from "../../../services/api"

export default {
  namespace:'submit',

  state:{
    shop: ''
  },

  effects: {
    *submit({ payload, callback }, { call, put }) {
      const response = yield call(submitApi, payload);
      if (callback && typeof callback === 'function') {
        callback(response);
      }
    },

    *shop({payload, callback},{call,put}){
      const response = yield call(shop, payload);
      yield put({
        type: 'saveshopurl',
        payload: response,
      });
    }
  },

  reducers: {
    saveshopurl(state,action){
      return{
        ...state,
        shop: action.payload.shop
      }
    }
  }

}
